﻿<?php

class vUser
{

	public static function LoginForm()
	{
		$xtpl = new XTemplate('xtpl/form-login.xtpl');
		$xtpl->parse('root');
		return $xtpl->text('root');
	}

	public static function WorkersTable($workers, $show_actions)
	{
		$xtpl = new XTemplate('xtpl/workers.xtpl');
		if($show_actions == true)
		{
			$xtpl->parse('root.table.actions');
		}
		foreach ($workers as $worker) {
			$xtpl->assign('id', $worker['id']);
			$xtpl->assign('fname', $worker['fname']);
			$xtpl->assign('lname', $worker['lname']);
			$xtpl->assign('phone', $worker['phone']);
			$xtpl->assign('dt_beg', $worker['dt_beg']);
			$xtpl->assign('email', $worker['email']);
			if($show_actions)
				$xtpl->parse('root.table.erow');
			else
				$xtpl->parse('root.table.row');
		}
		$xtpl->parse('root.table');
		$xtpl->parse('root.dlg');
		return $xtpl->text('root.table').$xtpl->text('root.dlg');
	}

}

